function pailie (arr) {
    let res = []
    const dfs = (path, index) => {
        if(path.length === arr.length) {
            res.push(path)
            return
        }
        arr[index].forEach(n => {
            dfs(path + n, index + 1);
        })
    }
    dfs("", 0)
    return res
}
// 时间复杂度O(n! * n)
// 空间复杂度O(n)
console.log(pailie([['A','a'],['B','b'],['1','2']]));